/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#include "DiagramDialog.h"
#include "Utilities.h"

namespace QSThink
{
	
	DiagramDialog::DiagramDialog( QWidget *parent )
		: QDialog(parent)
	{
		
		this->setWindowTitle("Diagram View");
		this->setSizeGripEnabled(false);
		
		_viewWidget=new DiagramWidget(this);
		QGridLayout* grid=new QGridLayout;
		grid->addWidget(_viewWidget,0,0);
		setLayout(grid);
	}

	DiagramDialog::~DiagramDialog()
	{

	}

	void DiagramDialog::load( QString symbol )
	{
		QString title=symbol;
		this->setWindowTitle(title);

		_viewWidget->load(symbol);
		

	}


	void DiagramDialog::loadCapital( QString symbol )
	{
		QString title=symbol;
		this->setWindowTitle(title);

		_viewWidget->loadCapital(symbol);

	}
	

	void DiagramDialog::load( QString symbol,QDate date )
	{
		QString title=symbol+" "+Utilities::getDateStr(date);
		this->setWindowTitle(title);

		_viewWidget->load(symbol,date);


	}

	void DiagramDialog::loadPriceEx( QString symbol )
	{
		QString title=symbol;
		this->setWindowTitle(title);

		_viewWidget->loadPriceEx(symbol);

	}

}
